/*
 * logon.h
 *
 *  Created on: Nov 15, 2013
 *      Author: killerg
 */

#ifndef LOGIN_H_
#define LOGIN_H_

struct logon_cfg_t;
struct my_clock_t;
struct auth_mgr_t;
struct server_session_t;
struct client_session_t;
struct server_mgr;

template<int NUM>
struct profiler_t;
struct db_mgr_t;
struct auth_session_t;
struct console_t2;
struct SvcData;

#include "client_session.h"
#include "server_session.h"

struct logon_t {
    bool init(SvcData* svcdata_);
    void destroy();
    void loop();

    console_t2* console;
    logon_cfg_t* cfg;
    my_clock_t* clock;
    auth_mgr_t* authmgr;
    server_mgr* svrmgr;
    auth_session_t* authsess;
    clientsess_mgr_t* clisess_mgr;
    serversess_mgr_t* svrsess_mgr;
    SvcData* svcdata;

    bool stat;
    int count[ELSTAGENUM];

    double cpu_time = 0.0f;
#define TIME_DEF(name) double name##_acc = 0.0f
    TIME_DEF(svrsess);
    TIME_DEF(clisess);
    TIME_DEF(authsess);
    TIME_DEF(console);
#undef TIME_DEF
};

extern logon_t g_logon;

#define g_console g_logon.console
#define g_cfg g_logon.cfg

#endif /* LOGIN_H_ */
